import React from "react";
import { Button, ButtonProps } from 'antd';
import { EditOutlined } from '@ant-design/icons';

import { withModal, mountModal } from "@yaf/pro-ui";

import AuthSecretKey from "./AuthSecretKey";

interface AuthSecretKeyBtnProps extends ButtonProps{
    accountId: string;
}

const AuthSecretKeyBtn: React.FC<AuthSecretKeyBtnProps> = ({accountId, size = "small", ...buttonProps}) => {

    return <Button
        icon={<EditOutlined />}
        onClick={() => {
            const AuthSecretKeyModal = withModal(AuthSecretKey);
            mountModal(<AuthSecretKeyModal
                modalProps={{
                    title: "授权秘钥",
                    width: "60%",
                }}
                accountId={accountId}
            />);
        }}
        {...buttonProps}
    >授权秘钥</Button>
}


export default AuthSecretKeyBtn;
